package org.travel.travel2gether.domain;

import java.util.List;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import org.codehaus.jackson.annotate.JsonIgnore;

@SuppressWarnings("serial")
@Entity
@Table(name = "account")
public class Account extends BaseEntity {

	@Column(unique = true)
	@NotNull
	private String username;
	
	@JsonIgnore
	private String password;

	@Enumerated(EnumType.STRING)
	private Role role = Role.GENERAL;
	
	@Column(name = "FIRST_NAME")
	private String firstName;
	
	@Column(name = "MIDDLE_NAME")
	private String middleName;
	
	@Column(name = "LAST_NAME")
	private String lastName;
	
	@Column(name = "IS_FACEBOOK_ACCOUNT")
	private boolean isFacebookAccount;
	
	@Column(name = "FACEBOOK_ID")
	private String facebookId;
	
	@Column(name = "FACEBOOK_LINK")
	private String facebookLink;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "account")
	private List<Car> cars;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "account")
	private List<Track> tracks;
	
	public Account() {
	}
	
	public Account(String username, String password, Role role) {
		this.username = username;
		this.password = password;
		this.role = role;
	}
	
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getMiddleName() {
		return middleName;
	}
	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public boolean isFacebookAccount() {
		return isFacebookAccount;
	}
	public void setFacebookAccount(boolean isFacebookAccount) {
		this.isFacebookAccount = isFacebookAccount;
	}
	public String getFacebookId() {
		return facebookId;
	}
	public void setFacebookId(String facebookId) {
		this.facebookId = facebookId;
	}

	public List<Car> getCars() {
		return cars;
	}

	public void setCars(List<Car> cars) {
		this.cars = cars;
	}

	public List<Track> getTracks() {
		return tracks;
	}

	public void setTracks(List<Track> tracks) {
		this.tracks = tracks;
	}
	
	public String getFacebookLink() {
		return facebookLink;
	}
	
	public void setFacebookLink(String facebookLink) {
		this.facebookLink = facebookLink;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
}
